<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>找出符合条件的数</title>
    </head>
    <body>
        <h3 style="text-align: center">找出1000 ~ 9999之间能够被17和13同时整除的整数、个数、累加和</h3>
        <div style="text-align: center">
            <textarea id="out" cols="80" rows="12" readonly></textarea>
        </div>
        <script>
            let str = "";
            let sum = 0,cnt = 0,t_line = 0;
            document.getElementById("out").innerHTML += "数字:\n";
            for(let i = 1000;i<10000;++i){
                if(i%13===0&&i%17===0){
                    str += i+'\t';
                    ++t_line;
                    ++cnt;
                    sum+=i;
                }
                if(t_line===10){
                    document.getElementById("out").innerHTML += str+'\n';
                    t_line = 0;
                    str = "";
                }
            }
            if(t_line!==0){
                document.getElementById("out").innerHTML += str+'\n';
            }
            document.getElementById("out").innerHTML += "个数:\n"+cnt+'\n';
            document.getElementById("out").innerHTML += "总和:\n"+sum;
        </script>
    </body>
</html>